#!/usr/bin/env Rscript

library(cluster)
library(mp)

data <- read.csv2("../app/data/proj/projection_data.csv")
m <- daisy(data)

#Generate projections with geography information
tsne_proj <- tSNE(m)
lamp_proj <- lamp(m)
lsp_proj <- lsp(m)

saveRDS(tsne_proj, "../app/data/rds/proj_with_geography_tsne.rds")
saveRDS(lamp_proj, "../app/data/rds/proj_with_geography_lamp.rds")
saveRDS(lsp_proj, "../app/data/rds/proj_with_geography_lsp.rds")

#Generate projections without geography information
data <- data[-c(1,2,3,4,5,6)]
m <- daisy(data)
tsne_proj <- tSNE(m)
lamp_proj <- lamp(m)
lsp_proj <- lsp(m)

saveRDS(tsne_proj, "../app/data/rds/proj_no_geography_tsne.rds")
saveRDS(lamp_proj, "../app/data/rds/proj_no_geography_lamp.rds")
saveRDS(lsp_proj, "../app/data/rds/proj_no_geography_lsp.rds")
